      SUBROUTINE SETUP
      INCLUDE 'COMMON.INC'
      INTEGER I
        GCONST(0)=.FALSE.
        DO I=1,NH+NG
          GCONST(I)=.TRUE.
        ENDDO
      RETURN
      END
C   HS112
      BLOCK DATA
      INCLUDE 'BLOCO.INC'
      INTEGER I,J
      DATA NAME/'HS112'/
      DATA (X(I),I=1,10)/10*.1D0/
      DATA N/10/ , NH/ 3/ , NG/10/
      DATA DEL0/1.0D-6/ ,TAU0/1.0D0/ ,TAU/.1D0/
      DATA (GUNIT(1,J),J=4,13)/10*1/,(GUNIT(3,I),I=4,13)/10*1/,
     F     (GUNIT(2,I),I=4,13)/1,2,3,4,5,6,7,8,9,10/
     F     ,((GUNIT(I,J),I=1,3),J=0,3)/-1,0,0,-1,0,0,-1,0,0,-1,0,0/
      END
      SUBROUTINE EF(X,FX)
      INCLUDE 'FUCO.INC'
      INTEGER I
      DOUBLE PRECISION FX,X(NX),C(10),Y(NX),S1,S2
      SAVE C
      DATA C/-6.08D0,-17.164D0,-34.054D0,-5.914D0,-24.721D0,-14.986D0,
     1       -24.1D0,-10.708D0,-26.662D0,-22.179D0/
      ICF=ICF+1
      S1=0.D0
      S2=0.D0
      DO      100      I=1,10
      Y(I)=DSQRT(X(I)**2+1.D-20)
      S1=S1+Y(I)
  100 CONTINUE
      DO      200      I=1,10
      S2=S2+Y(I)*(C(I)+DLOG(Y(I)/S1))
  200 CONTINUE
      FX= S2
      RETURN
      END
      SUBROUTINE EGRADF(X,GRADF)
      INCLUDE 'FUCO.INC'
      DOUBLE PRECISION X(NX),GRADF(NX),C(10),Y(NX),S1
      INTEGER I
      SAVE C
      DATA C/-6.08D0,-17.164D0,-34.054D0,-5.914D0,-24.721D0,-14.986D0,
     1       -24.1D0,-10.708D0,-26.662D0,-22.179D0/
      ICGF=ICGF+1
      S1=0.D0
      DO      100      I=1,10
      Y(I)=DSQRT(X(I)**2+1.D-20)
      S1=S1+ Y(I)
 100  CONTINUE
      DO      200      I=1,10
      GRADF(I)=DLOG(DABS(Y(I)/S1))
      IF ( X(I) .LT. 0.D0 ) GRADF(I)=-GRADF(I)
      GRADF(I)=GRADF(I)+C(I)
 200  CONTINUE
      RETURN
      END
      SUBROUTINE EH(I,X,HXI)
      INCLUDE 'FUCO.INC'
      DOUBLE PRECISION X(NX),HXI
      INTEGER I
      CRES(I)=CRES(I)+1
      GOTO (100,200,300),I
  100 CONTINUE
      HXI=X(1)+2.D0*X(2)+2.D0*X(3)+X(6)+X(10)-2.D0
      RETURN
  200 CONTINUE
      HXI=X(4)+2.D0*X(5)+     X(6)+X(7)-1.D0
      RETURN
  300 CONTINUE
      HXI=X(3)+X(7)+X(8)+2.D0*X(9)+X(10)-1.D0
      RETURN
      END
      SUBROUTINE EGRADH(I,X,GRADHI)
      INCLUDE 'FUCO.INC'
      INTEGER I,J
      DOUBLE PRECISION X(NX),GRADHI(NX),B(10,3)
      SAVE B
      DATA B/1.D0,2*2.D0,2*0.D0,1.D0,3*0.D0,1.D0,3*0.D0,1.D0,2.D0,
     1       2*1.D0,5*0.D0,1.D0,3*0.D0,2*1.D0,2.D0,1.D0/
      CGRES(I)=CGRES(I)+1
      DO      100      J=1,10
      GRADHI(J)=B(J,I)
  100 CONTINUE
      RETURN
      END
      SUBROUTINE EG(I,X,GXI)
      INCLUDE 'FUCO.INC'
      INTEGER I
      DOUBLE PRECISION X(NX),GXI
      IF ( GUNIT(1,I+NH) .EQ. -1 ) CRES(I+NH)=CRES(I+NH)+1
      GXI=X(I)-1.D-6
      END
      SUBROUTINE EGRADG(I,X,GRADGI)
      INCLUDE 'FUCO.INC'
      INTEGER I,J
      DOUBLE PRECISION X(NX) ,GRADGI(NX)
       DO     100      J=1,10
       GRADGI(J)=0.D0
  100  CONTINUE
      GRADGI(I)=1.D0
      RETURN
      END


